package com.teradata.olingo.processor.core.processor;

import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPath;
import com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType;

import java.util.List;
import java.util.Map;

final class GenericRequestEntityImpl implements GenericRequestEntity {
  private static final GenericModifyUtil util = new GenericModifyUtil();

  private final JPAEntityType et;
  private final Map<String, Object> jpaAttributes;
  private final Map<String, Object> jpaKeys;
  private final Map<JPAAssociationPath, List<GenericRequestEntity>> jpaDeepEntities;
  private final Map<JPAAssociationPath, List<GenericRequestLink>> jpaLinks;
  private final Map<String, List<String>> odataHeaders;

  GenericRequestEntityImpl(JPAEntityType et, Map<String, Object> jpaAttributes,
                           Map<JPAAssociationPath, List<GenericRequestEntity>> jpaDeepEntities,
                           Map<JPAAssociationPath, List<GenericRequestLink>> jpaLinks, Map<String, Object> keys,
                           Map<String, List<String>> headers) {
    super();
    this.et = et;
    this.jpaAttributes = jpaAttributes;
    this.jpaDeepEntities = jpaDeepEntities;
    this.jpaLinks = jpaLinks;
    this.jpaKeys = keys;
    this.odataHeaders = headers;
  }

  @Override
  public Map<String, Object> getData() {
    return jpaAttributes;
  }

  @Override
  public JPAEntityType getEntityType() {
    return et;
  }

  @Override
  public Map<String, Object> getKeys() {
    return jpaKeys;
  }

  @Override
  public GenericModifyUtil getModifyUtil() {
    return util;
  }

  @Override
  public Map<JPAAssociationPath, List<GenericRequestEntity>> getRelatedEntities() {
    return jpaDeepEntities;
  }

  @Override
  public Map<JPAAssociationPath, List<GenericRequestLink>> getRelationLinks() {
    return jpaLinks;
  }

  @Override
  public Map<String, List<String>> getAllHeader() {
    return odataHeaders;
  }
}
